/*********************
* Author:Dzlua
* QQ:505544956
* time:2016/08/08
*/
#ifndef __EDUI_BUTTON_H__
#define __EDUI_BUTTON_H__

#include "Label.h"

EDUI_NAMESPACE_BEGIN

class EDUI_API Button : public Label
{
public:
    struct {
        Event1<Button*> click;
    } evt;
protected:
    Button();
    virtual ~Button();
public:
	static Button* GetInterface();
	virtual void Release();
    static Button* ToButton(Control* ctrl);
public:
    void SetPressedOffset(int x, int y);
    Point GetPressedOffset();
    
protected:
    virtual bool HandleMsg(Msg* msg);
    virtual void RenderStatusImages(IRender* render, const Rect* rc);
    virtual void RenderText(IRender* render, const Rect* rc);

    virtual void SetAttribute(const char* name, const char* value);

    virtual Color* GetDestColor(const char* dstname);
    virtual ImageData* GetDestImageData(const char* dstname);

    virtual void DoEvent(EventType type, void* data1 = 0, void* data2 = 0);
protected:
    virtual void OnMouseOut();
protected:
    ButtonState m_state;

    ImageData m_normalImage;
    ImageData m_hotImage;
    ImageData m_pressedImage;
    ImageData m_disabledImage;

    Color m_hotTextColor;
    Color m_pressedTextColor;
    Color m_disabledTextColor;

    Point m_ptPressedOffset;
};


EDUI_NAMESPACE_END

#endif